<template>
  <div>
    <el-dialog
      :close-on-click-modal="false"
      title="试样详情"
      :beforeClose="handleClose2"
      :visible.sync="dialogVisible2"
      width="500px">
      <el-form :model="form" size="mini" label-width="120px"  ref="form">
        <el-form-item label="状态：" style="margin-bottom: 0">
          {{form.checkState | fifstate}}
        </el-form-item>
        <el-form-item label="客户名称：" style="margin-bottom: 0">
          {{form.customerName}}
        </el-form-item>
        <el-form-item label="产品线：" style="margin-bottom: 0">
          {{form.goodsLineName}}
        </el-form-item>
        <el-form-item label="试料牌号：" style="margin-bottom: 0">
          {{form.goodsSn}}
        </el-form-item>
        <el-form-item label="数量：" style="margin-bottom: 0">
          {{form.goodsNum}}
        </el-form-item>
        <el-form-item label="收货信息：" style="margin-bottom: 0">
          {{form.receiverName}} / {{form.receiverMobile}} / {{form.addressInfo}}
        </el-form-item>
        <el-form-item label="用料情况：" style="margin-bottom: 0">
          {{form.useGoodsInfo}}
        </el-form-item>
        <el-form-item label="申请人：" style="margin-bottom: 0">
          {{form.tryUserName}}
        </el-form-item>
        <el-form-item label="申请时间：" style="margin-bottom: 0">
          {{form.tryTime}}
        </el-form-item>
        <el-form-item label="试样结果：" style="margin-bottom: 0">
          {{form.tryResult}}
        </el-form-item>
        <el-form-item label="产品匹配度：" style="margin-bottom: 0">
          {{form.tryMatch}}
        </el-form-item>
        <el-form-item label="备注：" style="margin-bottom: 0">
          {{form.tryRemark}}
        </el-form-item>
        <el-form-item label="凭证：">
          <img :src="item"  v-for="item  in form.tryReport" style="width:50px;height:50px;object-fit: contain;cursor: pointer;margin-right:5px;" @click="fullImg(item)"/>
        </el-form-item>
        <div style="border-top:1px solid #eee;padding-top:15px">
          <el-timeline>
            <el-timeline-item
              v-for="(activity, index) in form.logList"
              :key="index"
              :timestamp="activity.logTime">
              {{activity.logUserName}} : {{activity.logContent}}
            </el-timeline-item>
          </el-timeline>
        </div>
      </el-form>
    </el-dialog>

    <!--放大图片-->
    <el-dialog
      :visible.sync="dialogVisible4"
      width="800px">
      <img :src="fullSrc" style="width:100%;"/>
    </el-dialog>
  </div>


</template>
<script>
import {getCustomerSetting,getQiniuToken,getCustomerOption} from '@/api/partner'
import {developGoodsTryDetail} from '@/api/company'
import {validatePhone} from '@/utils/validate';
import {formatDate} from '@/utils/date';
import store from '@/store'
import { mapGetters } from 'vuex'

const defaultForm = {

};
export default {
  name: "index",
  data(){

    return {
      dialogVisible2:false,
      title2:'',
      btnLoading2:false,
      form: {},
      dialogVisible4:false,
      fullSrc:'',
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'mobile',
      'userId'
    ]),
  },
  components : {

  },
  created() {

  },
  filters: {
    fifstate(val){
      if(val == 0){
        return '已申请'
      }else if(val == 10){
        return '已取消'
      }else if(val == 20){
        return '已试样'
      }
    },
  },
  methods:{

    fullImg(src){
      this.dialogVisible4 = true;
      this.fullSrc = src;
    },
    //显示
    showPop(item){
      this.dialogVisible2 = true;
      this.getInfo(item)
    },
    getInfo(item){
      developGoodsTryDetail({tryId:item.tryId}).then((res)=>{
        this.form = res;
      })
    },

    //关闭弹窗
    handleClose2(){
      this.$refs.form.clearValidate();
      this.dialogVisible2 = false;
      this.btnLoading2 = false;
    },


  },
}
</script>

<style  lang="scss">
.avatar-uploader{
  margin-bottom:10px;
  display: inline-block;
  width:80px;
  height:80px;
  border:1px solid #DCDFE6;
  text-align: center;
  line-height: 80px;
  vertical-align: middle;
}
</style>
